
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("Function Widget Demo"),
      ),
      body: AlertDialogWidget(),
    ),
  ));
}

class AlertDialogWidget extends StatelessWidget {


  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      title: const Text("提示"),
      content: const Text("您确定要删除当前文件吗?"),
      actions: <Widget>[
        TextButton(
          child: const Text("取消"),
          onPressed: () => Navigator.of(context).pop(),  //关闭对话框
        ),
        TextButton(
          child: const Text("删除"),
          onPressed: () => Navigator.of(context).pop(true), //关闭对话框
        ),
      ],
    );
  }
}

